﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class IceBlock : BasicBlock
{
    Vector2 direction;
    Vector2 norm;
    public float moveSpeed = 0.01f;

    public override void BlockIn(GameObject player)
    {
        base.BlockIn(player);

        norm = player.GetComponent<PlayerController>().moveDirection.normalized;
        norm.Scale(new Vector2(moveSpeed, moveSpeed));
        player.GetComponent<PlayerInput>().enableInput = false;
    }
    public override void BlockOut(GameObject player)
    {
        base.BlockOut(player);
        player.GetComponent<PlayerInput>().enableInput = true;
    }
    private void Update()
    {
        if (isPlayerIn)
        {
            foreach (GameObject player in players)
                player.transform.Translate(norm);
        }
    }
}
